import Vue from "vue";
import Router from "vue-router";
import index from "@/view/work/index";
import UnPay from "@/view/work/UnPay";
import Pay from "@/view/work/Pay";
import NoCost from "@/view/work/NoCost";
import setting from "@/setting";

Vue.use(Router);
export default new Router({
  mode: setting.routerMode,
  base: "/bpm-app/",
  routes: [
    {
      path: "/",
      name: "Index",
      redirect: "/xcHome",
      component: resolve => require(["@/view/index"], resolve),
      children: [
        {
          path: "userNotice",
          name: "userNotice",
          meta: {
            index: 3
          },
          component: resolve => require(["@/view/user/userNotice"], resolve)
        },

        {
          path: "/workOrder", // 动态参数需加冒号且与路径用斜杠分隔
          name: "workOrder",
          meta: {
            index: 5
          },
          component: resolve => require(["@/view/xcHome/workOrder"], resolve) // 保持动态导入方式
        },
        {
          path: "userInfo",
          name: "userInfo",
          meta: {
            index: 3
          },
          component: resolve => require(["@/view/user/userInfo"], resolve)
        },
        {
          name: "addressList",
          path: "address",
          meta: {
            index: 2
          },
          component: resolve => require(["@/view/addressList"], resolve)
        },
        {
          name: "work",
          path: "work",
          meta: {
            index: 1
          },
          component: resolve => require(["@/view/work"], resolve)
        },
        {
          path: "/index",
          name: "IndexPage",
          component: index
        },
        {
          path: "/UnPay",
          name: "UnPayPage",
          component: UnPay
        },
        {
          path: "/Pay",
          name: "PayPage",
          component: Pay
        },
        {
          path: "/NoCost",
          name: "NoCostPage",
          component: NoCost
        },
        {
          path: "/work/createOrder",
          name: "CreateOrder",
          meta: {
            index: 1
          },
          component: resolve => require(["@/view/work/createOrder"], resolve)
        },
        {
          path: "xcHome",
          name: "xcHome",
          meta: {
            index: 0
          },
          component: resolve => require(["@/view/xcHome"], resolve)
        },

        {
          path: "userDetail",
          name: "userDetail",
          meta: {
            index: 3
          },
          component: resolve => require(["@/view/user/userDetail"], resolve)
        },

        {
          path: "changePswd",
          name: "changePswd",
          meta: {
            index: 3
          },
          component: resolve => require(["@/view/user/changePswd"], resolve)
        },
        {
          path: '/parkDetail',  // 动态参数需加冒号且与路径用斜杠分隔
          name: 'parkDetail',
          meta: {
            index: 5
          },
          component: (resolve) => require(["@/view/xcHome/parkDetail"], resolve) // 保持动态导入方式
        },

      ],

    },
    {
      path: "/pointClock",
      name: "pointClock",
      meta: {
        index: 3
      },
      component: resolve => require(["@/view/xcHome/pointClock"], resolve)
    },
    {
      path: "/outClock",
      name: "outClock",
      meta: {
        index: 3
      },
      component: resolve => require(["@/view/xcHome/outClock"], resolve)
    },
    {
      path: "/login",
      name: "Login",
      component: resolve => require(["@/view/login/login"], resolve)
    },
    {
      path: "/forgetSecret",
      name: "forgetSecret",
      component: resolve => require(["@/view/login/forgetSecret"], resolve)
    },

    {
      path: "/forgetSecret2",
      name: "forgetSecret2",
      component: resolve => require(["@/view/login/forgetSecret2"], resolve)
    },
    {
      path: "/forgetSecret3",
      name: "forgetSecret3",
      component: resolve => require(["@/view/login/forgetSecret3"], resolve)
    },

    {
      path: "/homeEdit",
      name: "HomeEdit",
      component: resolve => require(["@/view/editInfo/homeEdit"], resolve)
    },
    {
      path: "/noPlate",
      name: "noPlate",
      component: resolve => require(["@/view/addressList/noPlate"], resolve)
    },
    {
      path: "/unpaid",
      name: "unpaid",
      component: resolve => require(["@/view/addressList/unpaid"], resolve)
    },
    {
      path: "/deviceWarning",
      name: "deviceWarning",
      component: resolve =>
        require(["@/view/addressList/deviceWarning"], resolve)
    },
    {
      path: "/messageAdd",
      name: "messageAdd",
      component: resolve =>
        require(["@/view/addressList/messageAdd"], resolve)
    },
  ]
});
